<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="../include/tag.jsp" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <title>个人排行</title>
    <%@include file="../include/commonFile.jsp" %>
    <link rel="stylesheet" href="${ctx}/css/common/list.css">
    <link rel="stylesheet" href="${ctx}/css/common/table.css">
</head>
<body>
<%@include file="../include/header.jsp" %>

<div class="index-outside">
    <%@include file="../include/sidebar.jsp" %>
    <section>
        <div class="section-main">
            <div class="layui-tab layui-tab-brief mt20">
                <ul class="layui-tab-title">
                    <li class="layui-this">个人排行</li>
                    <li>队伍排行</li>
                </ul>
                <div class="layui-tab-item  layui-show">
                    <form class="layui-form" action="${ctx}/sign/member/rankList.do?projectId=${groupMember.projectId}" id="myForm" method="post">
                        <input type="hidden" name="pageNo" id="pageNo"/>
                        <div class="f-search-bar">
                            <div class="search-container">
                                <ul class="search-form-content">
                                    <li class="form-item-inline"><label class="search-form-lable">成员名</label>
                                        <div class="layui-input-inline">
                                            <input type="text" name="memberName" autocomplete="off" class="layui-input"
                                                   value="${groupMember.memberName}"
                                                   placeholder="请输入查询成员名"
                                            >
                                        </div>
                                    </li>
                                    <li class="form-item-inline"><label class="search-form-lable">所属队伍</label>
                                        <div class="layui-input-inline">
                                            <select name="groupId">
                                                <option value="">全部</option>
                                                <c:forEach var="group" items="${signGroups}">
                                                    <option value="${group.id}" ${groupMember.groupId == group.id ? 'selected="selected"' : ""}>${group.name}</option>
                                                </c:forEach>
                                            </select>
                                        </div>
                                    </li>
                                    <li class="form-item-inline">
                                        <div class="sub-btns">
                                            <a class="layui-btn layui-btn-danger"
                                               href="javascript:submitFunction('#myForm')">查询</a>
                                            <a class="layui-btn layui-btn-normal"
                                               href="javascript:resetFunction('#myForm')">重置</a>
                                        </div>
                                    </li>
                                </ul>
                                <ul class="search-form-content">
                                    <li class="form-item"><label class="search-form-lable">时间</label>
                                        <div class="check-btn-inner">
                                            <a href="javascript:void(0);"
                                               onclick="setTimeType($(this),0,'#myForm')" ${empty type || type == 0 ? 'class="active"' : ''}>今日</a>
                                            <a href="javascript:void(0);"
                                               onclick="setTimeType($(this),4,'#myForm')" ${type == 4 ? 'class="active"' : ''}>昨日</a>
                                            <a href="javascript:void(0);"
                                               onclick="setTimeType($(this),1,'#myForm')" ${type == 1 ? 'class="active"' : ''}>本周</a>
                                            <a href="javascript:void(0);"
                                               onclick="setTimeType($(this),2,'#myForm')" ${type == 2 ? 'class="active"' : ''}>本月</a>
                                            <a href="javascript:void(0);"
                                               onclick="setTimeType($(this),3,'#myForm')" ${type == 3 ? 'class="active"' : ''}>历史</a>
                                            <input type="hidden" name="type" value="${type}"/>
                                        </div>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </form>
                    <div class="my-act-list-content">
                        <div class="cl">
                            <table class="layui-table">
                                <colgroup>
                                    <col>
                                    <col>
                                    <col>
                                    <col>
                                    <col>
                                    <col>
                                    <col>
                                    <col>
                                </colgroup>
                                <thead>
                                <tr>
                                    <th>排名</th>
                                    <th>成员名</th>
                                    <th>公司</th>
                                    <th>职务</th>
                                    <th>联系电话</th>
                                    <th>所属队伍</th>
                                    <th>步数</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <c:forEach var="groupMember" items="${groupMembers}">
                                    <tr>
                                        <td>${groupMember.rank}</td>
                                        <td class="table-member"
                                            onclick="openDialogShow('成员名片','${ctx}/system/member/memberView.do?id=${groupMember.memberId}','400px','470px')">
                                            <div class="member-cell">
                                                <div class="member-logo common-img">
                                                    <img src="<c:if test="${ groupMember.memberLogo!= null}">${groupMember.memberLogo}?imageMogr2/auto-orient/crop/126x126</c:if>"
                                                         alt=""
                                                         onerror="txz.errImg(this)" onload="txz.imgLoad(this)">
                                                </div>
                                                <div class="member-name ellipsis-1">
                                                    <a class="blue" title="${groupMember.memberName}"
                                                       href="javascript:void(0);">
                                                            ${groupMember.memberName}
                                                    </a>
                                                </div>
                                            </div>
                                        </td>
                                        <td>
                                            <div class="ellipsis-1"
                                                 title="${groupMember.memberCompany}">${groupMember.memberCompany}</div>
                                        </td>
                                        <td>${groupMember.memberJobTitle}</td>
                                        <td>${groupMember.memberMobile}</td>
                                        <td>${groupMember.groupName}</td>
                                        <td>${groupMember.stepNum}</td>
                                        <td>
                                            <a href="javascript:openDialog('查看打卡记录','${ctx}/sign/member/myRecordList.do?applyId=${groupMember.id}','600px','500px')">查看打卡记录</a>
                                        </td>
                                    </tr>
                                </c:forEach>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="page-content">
                        <div id="page_content" class="page-container"></div>
                    </div>
                </div>
                <div class="layui-tab-item"></div>
            </div>
        </div>
        <%@include file="../include/footer.jsp" %>
    </section>
</div>
<script type="text/javascript" src="${ctx}/script/common/table_option.js"></script>
<script type="text/javascript" src="${ctx}/script/common/list.js"></script>

<script type="text/javascript">
    var laytpl = null;
    var laypage = null;
    var element = null;
    $(function () {

        //加载分页
        loadPageNew({
            elem: 'page_content',
            totalCount: '${page.totalCount}',
            limit: '${page.limit}',
            page: '${page.page}'
        });

        layui.use(['laytpl', 'laypage', 'element'], function () {
            laytpl = layui.laytpl;
            laypage = layui.laypage;
            element = layui.element;

            element.on('tab', function (data) {
                if (data.index == 0) {
                    window.location.href = "${ctx}/sign/member/rankList.do?projectId=${signProject.id}";
                }
                else if (data.index == 1) {
                    window.location.href = "${ctx}/sign/group/rankList.do?projectId=${signProject.id}";
                }
            });
        });

    })
    var url = window.location.href;
    $("#myForm").attr("action", url);

    function openDialog(title, url, width, height, target) {
        layer.open({
            type: 2,
            area: [width, height],
            title: title,
            maxmin: true, //开启最大化最小化按钮
            content: url,
            btn: ['确定', '关闭'],
            yes: function (index, layero) {
                var body = layer.getChildFrame('body', index);
                var iframeWin = layero.find('iframe')[0]; //得到iframe页的窗口对象，执行iframe页的方法：iframeWin.method();
                var inputForm = body.find('#inputForm');
                var top_iframe;
                if (target) {
                    top_iframe = target;//如果指定了iframe，则在改frame中跳转
                } else {
                    top_iframe = '_parent';//获取当前active的tab的iframe
                }
                inputForm.attr("target", top_iframe);//表单提交成功后，从服务器返回的url在当前tab中展示

                if (iframeWin.contentWindow.doSubmit()) {
                    setTimeout(function () {
                        top.layer.close(index);
                    }, 100);//延时0.1秒，对应360 7.1版本bug

                    setTimeout(function () {
                        window.location.reload();
                    }, 200);
                }

            },
            cancel: function (index) {
            }
        });
    }
</script>
<script type="text/javascript">
    txz.initHeader({
        nav: [{
            name: '我发布的打卡项目',
            href: '${ctx}/sign/project/list.do'
        }, {
            name: '${signProject.title}',
            href: '${ctx}/sign/project/list.do'
        }, {
            name: '数据查看',
            curr: true
        }],
        btns: [{
            name: '返回',
            href: 'javascript:history.back();',
            icon: 'back'
        }]
    });
</script>
</body>
</html>
